<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>租户管理</title>
<link rel="stylesheet" href="../static/main/css/styles.css">
<link rel="stylesheet" type="text/css"
	href="../static/jquery-ui-themes-1.10.4/themes/ui-darkness/jquery.ui.theme.css">
<link rel="stylesheet" type="text/css"
	href="../static/jquery-ui-themes-1.10.4/themes/ui-darkness/jquery-ui.css">
<link rel="stylesheet"
	href="../webjars/bootstrap/3.3.7-1/css/bootstrap.css">
<link rel="stylesheet" type="text/css"
	href="../static/jqgrid/css/ui.jqgrid.css">
<script type="text/javascript"
	src="../static/jqgrid/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="../webjars/bootstrap/3.3.7-1/js/bootstrap.js"></script>
<script type="text/javascript"
	src="../static/jqgrid/js/jquery.jqGrid.min.js"></script>
<script type="text/javascript" src="../static/laydate/laydate.js"></script>
<script type="text/javascript" src="../static/jqgrid/js/jquery-ui.js"></script>
<script type="text/javascript"
	src="../static/jqgrid/js/grid.locale-cn.js"></script>

<script type="text/javascript">
	$(function(){
		$('#list1').jqGrid({
			url: 'list',
			editurl:'edit',
			caption:'租户列表', 
			altRow:true,
			autowidth:true,
			width:'100%',
			/* height:'100%', */
			datatype:'json',
			mtype:'post',
			PageSize: 15,
			rowNum:10,
			rowList : [5 , 10, 35, 100 ],
			prmNames:{search:'search'},
			sortname:'id',
			viewrecords:true,
			pager:'#dhl',
			jsonReader:{
				repeatitems:false,
				id:'id'
			},
			colModel:[
				//{name:'id',label:'编号',index:'id',align:'center',width:'60',sorttype:'int'},
				{name:'name',label:'租户名称',index:'name',align:'center',width:'100',sorttype:'text',editable:true
				,editrules: { required: true,custom_func: Validatename}
				},
				{name:'username',label:'用户名',index:'username',align:'center',sorttype:'text',editable:true
				,editrules: { required: true,meil:true,custom_func: Validateeditrules}
				},
				{name:'password',label:'密码',index:'password',align:'center',width:'100',editable:true,sortable:false ,edittype:'password',hidden:true,editrules:{edithidden:true,required: true, number: true}},
				{name:'number',label:'联系电话',index:'number',align:'center',width:'100',sorttype:'text',editable:true
				,editrules: { required: true, number: true, custom_func: ValidateTvalue }
				},
				{name:'start',label:'注册时间',index:'start',align:'center',formatter:"date",formatoptions: {newformat:'Y-m-d'},align:'center',width:100,sorttype:'text',editable:true
						,editoptions:{
			                dataInit:function(e){
			                laydate.render({
	                			elem: e //指定元素
		                	});
		                
		                 	 /* $(e).datepicker({
		                        language:"zh-CN",//语言
		                        autoclose: true,//自动关闭
		                        todayBtn: "linked",//
		                        format: "yyyy-mm-dd"//时间显示格式
		                    }); */
		                    $(this).click(function(e){//选中时间后隐藏
		                        $(e).parent().datepicker('hide');
		                    });
		                }
		            },sortable : false},
				{name:'over',label:'到期时间',index:'over',formatter:"date", formatoptions: {newformat:'Y-m-d'},align:'center',width:100,sorttype:'text',editoptions:{
		                dataInit:function(e){
		                laydate.render({
	                		  elem: e //指定元素
	                		});
		                
		                  /*   $(e).datepicker({
		                        language:"zh-CN",//语言
		                        autoclose: true,//自动关闭
		                        todayBtn: "linked",//
		                        format: "yyyy-mm-dd"//时间显示格式
		                    }); */
		                    $(this).click(function(e){//选中时间后隐藏
		                        $(e).parent().datepicker('hide');
		                    });
		                }
		            },sortable : false},
				{name:'money',label:'缴费金额',index:'money',align:'center',width:100,sorttype:'text',editable:true}
			]
			
		});
	 function Validateeditrules(value, name) {
		if (value < 0 && value >10) {
		return [false,"用户名不是大于0和小于10的值"];
		}
		else {
		return [true,""];
		}
	} 
	
	
	 function Validatename(value, name) {
		if (value < 0 && value >20) {
		return [false,"请输入0到20之间的值"];
		}
		else {
		return [true,""];
		}
	} 
	
	 	
	function ValidateTvalue(value,name) {
        if(!(/^(1[3-9])\d{9}$/.test(value))){
                  return [false, "不是完整的11位手机号或者正确的手机号格式"]; 
             }else{
                return [true,""];
              }  
        //#endregion
} 
	
		$('#list1').jqGrid('navGrid', '#dhl', {
				edit : true,
				add : true,
				del : true,
				/* view : true, */
				 addtext:'添加',edittext:'编辑', deltext:'删除',searchtext:'查找',refreshtext:'刷新',position:'left'
			}, {
				top:204,
				left:453
				
			}, {
				top:204,
				left:453
			}, {
				top:204,
				left:453
			},{
				multipleSearch:true
			}
			);

		});
	</script>
<style type="text/css">
.neirong {
	margin: 0;
	padding-left: 15%;
	padding-right: 15%;
}

#fa {
	margin: 0;
	padding: 0 5px;
	font-weight: 1000;
	font-size: 25px;
}

.ui-pg-input {
	background: #999;
	color: #000;
	text-align: center;
	font-size: 20px;
	font-weight: 1000;
}

.ui-pg-selbox {
	background: #999;
	color: #000;
	font-weight: 1000;
}

.ui-pg-selbox option {
	font-weight: 1000;
}

#password {
	background: black;
	color: #ffffff;
	/* border: 1px solid #666666; */
	/* padding: .3em;
			margin: 0em; */
	font-family: Segoe UI, Arial, sans-serif;
	font-size: 1em;
	border-top-left-radius: 6px;
	border-top-right-radius: 6px;
	border-bottom-left-radius: 6px;
	border-bottom-right-radius: 6px;
}

select {
	background: #999;
	color: #000;
}

option {
	background: #999;
	color: #000;
}

.add-rule ui-add {
	color: #000;
}

input[type="button"] {
	color: #000;
}
</style>
</head>
<body>
	<div class="caidan">
		<div class="htmleaf-container">
			<nav class="animenu">
				<ul class="animenu__nav"
					style="margin-left: 15%; margin-right: 15%;">
					<li style="font-size: 20px; font-weight: 1100;"><a id="fa">发票管理系统</a></li>
					<li><a href="../main"><span
							class="glyphicon glyphicon-home">首页</span></a></li>
					<li><a>欢迎您:<span sec:authorize="hasRole('ROLE_DBA')">>开发者</span><span
							sec:authorize="!hasRole('ROLE_DBA')"
							sec:authentication="principal.name">张三</span></a></li>
					<li sec:authorize="hasRole('ROLE_MANAGER')"><a
						href="../UserTenant/zuhugl"><span
							class="glyphicon glyphicon-pencil">租户编辑</span></a></li>
					<li sec:authorize="hasRole('ROLE_ADMIN')"><a
						href="../UserManager/xzgl"><span
							class="glyphicon glyphicon-pencil">用户编辑</span></a></li>
					<li sec:authorize="hasRole('ROLE_ZUHU')"><a
						href="../User/xzgl"><span class="glyphicon glyphicon-pencil">用户管理</span></a></li>
					<li sec:authorize="hasRole('ROLE_MANAGER')"><a
						href="../UserManager/fpcx">电子发票查询</a></li>
					<li sec:authorize="hasRole('ROLE_MANAGER')"><a
						href="../UserManager/sqxx">软件授权信息</a>
					<li sec:authorize="hasRole('ROLE_ZUHU')"><a
						href="../Tenantxx/zxfp">新增电子发票信息</a></li>
					<li sec:authorize="hasRole('ROLE_ADMIN')"><a
						href="../SysUser/yhcz">用户操作日志</a></li>
					<li sec:authorize="hasRole('ROLE_ZUHU')"><a
						href="../UserTenant/xgmm">修改密码</a></li>
					<li sec:authorize="hasRole('ROLE_MANAGER')"><a
						href="../UserManager/xgmm">修改密码</a></li>
					<li sec:authorize="hasRole('ROLE_ADMIN')"><a
						href="../SysUser/xgmm">修改密码</a></li>
					<li style="float: right;"><a href="../logout"><span
							class="glyphicon glyphicon-off">注销</span></a></li>
				</ul>
			</nav>
		</div>
	</div>

	<div class="neirong">
		<table id="list1"></table>
		<div id="dhl"></div>
	</div>
</body>
</html>